/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bionic.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Obuhov D.G.
 */
@Entity
@Table(name = "reqest")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Reqest.findAll", query = "SELECT r FROM Reqest r"),
    @NamedQuery(name = "Reqest.findById", query = "SELECT r FROM Reqest r WHERE r.id = :id"),
    @NamedQuery(name = "Reqest.findByAmountFrom", query = "SELECT r FROM Reqest r WHERE r.amountFrom = :amountFrom"),
    @NamedQuery(name = "Reqest.findByCreateDate", query = "SELECT r FROM Reqest r WHERE r.createDate = :createDate"),
    @NamedQuery(name = "Reqest.findByExpireDate", query = "SELECT r FROM Reqest r WHERE r.expireDate = :expireDate"),
    @NamedQuery(name = "Reqest.findByCloseDate", query = "SELECT r FROM Reqest r WHERE r.closeDate = :closeDate")})
public class Reqest implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reqestId")
    private Collection<Document> documentCollection;
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "amount_from")
    private BigDecimal amountFrom;
    @Column(name = "create_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Column(name = "expire_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date expireDate;
    @Column(name = "close_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date closeDate;
    @JoinColumn(name = "currency_to_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Currency currencyToId;
    @JoinColumn(name = "currency_from_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Currency currencyFromId;
    @JoinColumn(name = "reqest_type_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ReqestType reqestTypeId;
    @JoinColumn(name = "status_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ReqestStatus statusId;
    @JoinColumn(name = "user_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Users userId;

    public Reqest() {
    }

    public Reqest(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getAmountFrom() {
        return amountFrom;
    }

    public void setAmountFrom(BigDecimal amountFrom) {
        this.amountFrom = amountFrom;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(Date expireDate) {
        this.expireDate = expireDate;
    }

    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    public Currency getCurrencyToId() {
        return currencyToId;
    }

    public void setCurrencyToId(Currency currencyToId) {
        this.currencyToId = currencyToId;
    }

    public Currency getCurrencyFromId() {
        return currencyFromId;
    }

    public void setCurrencyFromId(Currency currencyFromId) {
        this.currencyFromId = currencyFromId;
    }

    public ReqestType getReqestTypeId() {
        return reqestTypeId;
    }

    public void setReqestTypeId(ReqestType reqestTypeId) {
        this.reqestTypeId = reqestTypeId;
    }

    public ReqestStatus getStatusId() {
        return statusId;
    }

    public void setStatusId(ReqestStatus statusId) {
        this.statusId = statusId;
    }

    public Users getUserId() {
        return userId;
    }

    public void setUserId(Users userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reqest)) {
            return false;
        }
        Reqest other = (Reqest) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Reqest{" + "id=" + id + ", amountFrom=" + amountFrom + ", createDate=" + createDate + ", expireDate=" + expireDate + ", closeDate=" + closeDate + ", currencyToId=" + currencyToId + ", currencyFromId=" + currencyFromId + ", reqestTypeId=" + reqestTypeId + ", statusId=" + statusId + ", userId=" + userId + '}';
    }

    @XmlTransient
    public Collection<Document> getDocumentCollection() {
        return documentCollection;
    }

    public void setDocumentCollection(Collection<Document> documentCollection) {
        this.documentCollection = documentCollection;
    }

   
    
}
